package leetcode;

public class FindTheArrayConcVal {
    public long findTheArrayConcVal(int[] nums) {
        int len = nums.length;
        int i = 0, j = len - 1;
        long res = 0;
        while (i < j) {
            res += Long.parseLong(nums[i] + "" + nums[j]);
            i++;
            j--;
        }
        return len % 2 == 0 ? res : (res + nums[i]);
    }

    public static void main(String[] args) {
        FindTheArrayConcVal findTheArrayConcVal = new FindTheArrayConcVal();
        int[] nums = {5, 14, 13, 8, 12};
        System.out.println(findTheArrayConcVal.findTheArrayConcVal(nums));
    }
}
